package com.jvyou.thread.d08yield;

/**
 * @author 橘柚
 * @version 1.0-SNAPSHOT
 * @Date 2024/7/30 18:42
 * @Description 一个普普通通的线程
 */
public class MyThread extends Thread {
    public MyThread(String name) {
        super(name);
    }

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(getName() + "--->" + i);
            Thread.yield();
        }
    }

    public static void main(String[] args) {
        MyThread t1 = new MyThread("多来A梦");
        MyThread t2 = new MyThread("大雄");
        t1.start();
        t2.start();
    }
}
